//
//  ByBlueToothMeaturesL3Model.m
//  laserdevice_ios
//
//  Created by pro on 17/2/14.
//  Copyright © 2017年 com.itboye. All rights reserved.
//

#import "ByBlueToothMeaturesL3Model.h"

@implementation ByBlueToothMeaturesL3Model
- (instancetype)initWithDataHexString:(NSString *)hexStr {
    
    if (self = [super initWithDataHexString:hexStr]) {
        
//        self.name = @"L3模型";
        self.name = [NSString stringWithFormat:@"L3%@", STRING(@"moxing")];

        NSString *dataStr = [hexStr substringWithRange:NSMakeRange(42, 18)];
        self.length = [[self getNumberFromHexStr:dataStr] floatValue];
        
        NSLog(@"%li,%.2f", self.numOfData, self.length);
    }
    return self;
}

- (instancetype)initWithJsonDic:(NSDictionary *)jsonDic {
    
    if (self = [super initWithJsonDic:jsonDic]) {
        
        NSArray *attributes = jsonDic[@"attributes"];
        self.length = [attributes[0] floatValue];
    }
    return self;
}

- (NSDictionary *)saveDic {
    
    NSArray *attributes = @[[NSString stringWithFormat:@"%.6lf", self.length]];
    return @{@"name"        :self.name,
             @"attributes"  :attributes,};
}



- (NSString *)lengthStr {
    
    return [self getStringFromLength:self.length];
}


@end
